#!/usr/bin/env python

import sys
from PyQt4 import QtGui
from PyQt4 import QtCore

app = QtGui.QApplication(sys.argv)
app.setApplicationName("snipdom")

codeIn = QtGui.QTextEdit()
codeIn.setPlainText("code it")

runButton = QtGui.QPushButton("run it!")
runList = [open(sys.argv[0]).read()]

snipdom = QtGui.QSplitter()
snipdom.addWidget(codeIn)
snipdom.addWidget(runButton)

snipdom.setOrientation(QtCore.Qt.Vertical)

snipdom.show()

def runIt():
    code = str(codeIn.toPlainText())
    runList.append(code)
    exec(code, globals())

runButton.clicked.connect(runIt)

if __name__=='__main__':
    for i in sys.argv[1:]:
        codeIn.setPlainText(open(i).read())
        runButton.click()
    app.exec_()
